Solenoid valves of the generic type are known. Solenoid valves, which comprise a core sleeve, in which a valve element is arranged so as to be longitudinally displaceable, and wherein the core sleeve is covered by a housing sleeve, are used, for example, as control valves in hydraulic devices, for example braking systems of motor vehicles. The housing sleeves are generally composed of a sheet metal, which is welded together with the, generally steel, core sleeve for the permanent connection of the two parts. This welding serves to eliminate cost-intensive fastening elements. The welding is generally performed over the outer circumference in a circumferential direction with a certain overlap of the weld seam, that is to say over a circumferential angle of >360°. For welding, the core sleeve and the housing sleeve must bear directly against one another, in order to convert the energy input into the formation of the weld seam. The housing sleeve with the core sleeve to be welded is rotated in a circumferential direction along the welding appliance, in order to produce the welding, or the welding appliance has to be moved around the solenoid valve. This calls for a high level of precision with regard to the relative arrangement of the core sleeve and the housing sleeve, and the required rotation makes the all-round welding intricate in terms of design and costly in terms of the required process time.